package view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Toolkit;

import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;

import control.Controler;

public class Interface extends javax.swing.JFrame{

	private Controler control;

	public Interface(){
		control = new Controler(this);
		initComponents();
		control.registraEventos();
	}

	public void initComponents(){

		java.awt.GridBagConstraints gridBagConstraints;
		
		desktopPane = new javax.swing.JDesktopPane();
		panelBotao = new javax.swing.JPanel();
		btnNovaConta = new javax.swing.JButton("Adicionar Conta");
		btnRemoverConta = new javax.swing.JButton("Remover Conta");
		btnEditarConta = new javax.swing.JButton("Editar Conta");
		btnConsultarConta = new javax.swing.JButton("Consultas...");
		menuBar = new javax.swing.JMenuBar();
		menuAdicionar = new javax.swing.JMenu("Adicionar");
		menuRemover = new javax.swing.JMenu("Remover");
		menuEditar = new javax.swing.JMenu("Editar");
		menuConsultar = new javax.swing.JMenu("Consultas");
		menuItemAdicionar = new javax.swing.JMenuItem("Adicionar Conta");
		menuItemRemover = new javax.swing.JMenuItem("Remover Conta");
		menuItemEditar = new javax.swing.JMenuItem("Editar Conta");
		menuItemConsultar = new javax.swing.JMenuItem("Consultar...");

		menuAdicionar.add(menuItemAdicionar);
		menuRemover.add(menuItemRemover);
		menuEditar.add(menuItemEditar);
		menuConsultar.add(menuItemConsultar);

		menuBar.add(menuAdicionar);
		menuBar.add(menuRemover);
		menuBar.add(menuEditar);
		menuBar.add(menuConsultar);

		getContentPane().setLayout(new java.awt.GridBagLayout());

		gridBagConstraints = new java.awt.GridBagConstraints();
		gridBagConstraints.gridx = 0;
		gridBagConstraints.gridy = 0;
		gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER;
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
		gridBagConstraints.weightx = 100.0;
		getContentPane().add(menuBar, gridBagConstraints);

		desktopPane.setBackground(Color.LIGHT_GRAY);
		gridBagConstraints = new java.awt.GridBagConstraints();
		gridBagConstraints.gridx = 0;
		gridBagConstraints.gridy = 1;
		gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER;
		gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
		gridBagConstraints.weightx = 100.0;
		gridBagConstraints.weighty = 100.0;
		getContentPane().add(desktopPane, gridBagConstraints);

		panelBotao.add(btnNovaConta);
		panelBotao.add(btnRemoverConta);
		panelBotao.add(btnEditarConta);
		panelBotao.add(btnConsultarConta);

		panelBotao.setBorder(BorderFactory.createEtchedBorder());
		gridBagConstraints = new java.awt.GridBagConstraints();
		gridBagConstraints.gridx = 0;
		gridBagConstraints.gridy = 2;
		gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER;
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
		gridBagConstraints.weightx = 100.0;
		getContentPane().add(panelBotao, gridBagConstraints);

		//Icone
		Toolkit k = this.getToolkit();
		Image ic = k.getImage("dinheiro.png");
		setIconImage(ic);
		
		setTitle("Conta Swing");
		setVisible(true);
		setResizable(true);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setSize(new Dimension(800, 600));
		setLocation(275, 100);
	}

	private javax.swing.JDesktopPane desktopPane;
	private javax.swing.JPanel panelBotao;
	private javax.swing.JButton btnNovaConta;
	private javax.swing.JButton btnRemoverConta;
	private javax.swing.JButton btnEditarConta;
	private javax.swing.JButton btnConsultarConta;
	private javax.swing.JMenuBar menuBar;
	private javax.swing.JMenu menuAdicionar;
	private javax.swing.JMenu menuRemover;
	private javax.swing.JMenu menuEditar;
	private javax.swing.JMenu menuConsultar;
	private javax.swing.JMenuItem menuItemAdicionar;
	private javax.swing.JMenuItem menuItemRemover;
	private javax.swing.JMenuItem menuItemEditar;
	private javax.swing.JMenuItem menuItemConsultar;

	public javax.swing.JButton getBtnNovaConta() {
		return btnNovaConta;
	}

	public javax.swing.JButton getBtnRemoverConta() {
		return btnRemoverConta;
	}

	public javax.swing.JButton getBtnEditarConta() {
		return btnEditarConta;
	}

	public javax.swing.JButton getBtnConsultarConta() {
		return btnConsultarConta;
	}
	
	public void lancarFrame(JInternalFrame j){
		desktopPane.add(j);
	}
	
	public javax.swing.JMenuItem getMenuItemAdicionar() {
		return menuItemAdicionar;
	}

	public javax.swing.JMenuItem getMenuItemRemover() {
		return menuItemRemover;
	}

	public javax.swing.JMenuItem getMenuItemEditar() {
		return menuItemEditar;
	}

	public javax.swing.JMenuItem getMenuItemConsultar() {
		return menuItemConsultar;
	}
}
